package com.feinno.urcs.group.entity;

import java.util.List;

import com.feinno.superpojo.SuperPojo;
import com.feinno.superpojo.annotation.Childs;
import com.feinno.superpojo.annotation.Entity;
import com.feinno.superpojo.annotation.Field;
import com.feinno.superpojo.annotation.NodeType;

@Entity(name = "conference-info", standalone = true)
public class GroupChatMemberNotifyInfo extends SuperPojo {

    @Field(id = 1, name = "xmlns", type = NodeType.ATTR)
    private String xmlns = "urn:ietf:params:xml:ns:conference-info";

    @Field(id = 2, name = "entity", type = NodeType.ATTR)
    private String entity;

    @Field(id = 3, name = "state", type = NodeType.ATTR)
    private String state = "full";

    @Field(id = 4, name = "version", type = NodeType.ATTR)
    private String version = "1";

    @Field(id = 5, name = "conference-description")
    private ConferenceDescription conferenceDescription;

    @Field(id = 6, name = "conference-state")
    private ConferenceState conferenceState;

    @Field(id = 8, name = "user-policy")
    private UserPolicy userPolicy;

    @Childs(id = 7, parent = "users", child = "user")
    private List<MemberInfo> users;

    public String getXmlns() {
        return xmlns;
    }

    public void setXmlns(String xmlns) {
        this.xmlns = xmlns;
    }

    public String getEntity() {
        return entity;
    }

    public void setEntity(String entity) {
        this.entity = entity;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public ConferenceDescription getConferenceDescription() {
        return conferenceDescription;
    }

    public void setConferenceDescription(ConferenceDescription conferenceDescription) {
        this.conferenceDescription = conferenceDescription;
    }

    public ConferenceState getConferenceState() {
        return conferenceState;
    }

    public void setConferenceState(ConferenceState conferenceState) {
        this.conferenceState = conferenceState;
    }

    public List<MemberInfo> getUsers() {
        return users;
    }

    public void setUsers(List<MemberInfo> users) {
        this.users = users;
    }

    public UserPolicy getUserPolicy() {
        return userPolicy;
    }

    public void setUserPolicy(UserPolicy userPolicy) {
        this.userPolicy = userPolicy;
    }

    @Entity(name = "conference-description")
    public static class ConferenceDescription extends SuperPojo {

        /**
         * 群标题
         */
        @Field(id = 1, name = "subject")
        private String subject;

        /**
         * 最大用户数
         */
        @Field(id = 2, name = "maximum-user-count")
        private String maximum_user_count;

        public String getSubject() {
            return subject;
        }

        public void setSubject(String subject) {
            this.subject = subject;
        }

        public String getMaximum_user_count() {
            return maximum_user_count;
        }

        public void setMaximum_user_count(String maximum_user_count) {
            this.maximum_user_count = maximum_user_count;
        }
    }

    @Entity(name = "user-policy")
    public static class UserPolicy extends SuperPojo {
        @Field(id = 1, name = "offlinesm")
        private int offlinesm;

        public int getOfflinesm() {
            return offlinesm;
        }

        public void setOfflinesm(int offlinesm) {
            this.offlinesm = offlinesm;
        }
    }

    @Entity(name = "supported-medias")
    public static class SupportedMedias extends SuperPojo {
        @Field(id = 1, type = NodeType.ATTR)
        private String xmlns;

        public String getXmlns() {
            return xmlns;
        }

        public void setXmlns(String xmlns) {
            this.xmlns = xmlns;
        }
    }

    @Entity(name = "conference-state")
    public static class ConferenceState extends SuperPojo {

        @Field(id = 1, name = "user-count")
        public String userCount;

        @Field(id = 2, name = "active")
        public boolean active;

        @Field(id = 3, name = "locked")
        public boolean locked;

        public String getUserCount() {
            return userCount;
        }

        public void setUserCount(String userCount) {
            this.userCount = userCount;
        }

        public boolean isActive() {
            return active;
        }

        public void setActive(boolean active) {
            this.active = active;
        }

        public boolean isLocked() {
            return locked;
        }

        public void setLocked(boolean locked) {
            this.locked = locked;
        }
    }

    @Entity(name = "roles")
    public static class Roles extends SuperPojo {
        @Field(id = 1, type = NodeType.NODE)
        private String entry;

        public String getEntry() {
            return entry;
        }

        public void setEntry(String entry) {
            this.entry = entry;
        }
    }

    /**
     * 会话中用户状态信息Bean
     *
     * @author Lv.Mingwei
     */
    @Entity(name = "user")
    public static class MemberInfo extends SuperPojo implements Cloneable {

        @Field(id = 1, type = NodeType.ATTR)
        private String entity;

        @Field(id = 2, type = NodeType.ATTR)
        private String state;

        @Field(id = 3, type = NodeType.ATTR)
        private String yourown;

        @Field(id = 5, type = NodeType.NODE)
        private Roles roles;

        @Field(id = 4, type = NodeType.NODE)
        private UserEndpoint endpoint;

        @Field(id = 6, type = NodeType.NODE)
        private String etype;

        public String getEtype() {
            return etype;
        }

        public void setEtype(String etype) {
            this.etype = etype;
        }

        public Roles getRoles() {
            return roles;
        }

        public void setRoles(Roles roles) {
            this.roles = roles;
        }

        public MemberInfo() {
        }

        public String getEntity() {
            return entity;
        }

        public void setEntity(String entity) {
            this.entity = entity;
        }

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getYourown() {
            return yourown;
        }

        public void setYourown(String yourown) {
            this.yourown = yourown;
        }

        public UserEndpoint getEndpoint() {
            return endpoint;
        }

        public void setEndpoint(UserEndpoint endpoint) {
            this.endpoint = endpoint;
        }

        @Override
        public MemberInfo clone() {
            MemberInfo retval = new MemberInfo();
            retval.entity = entity;
            retval.state = state;
            retval.yourown = yourown;
            retval.endpoint = endpoint.clone();
            return retval;
        }
    }

    /**
     * 会话用户状态及地址
     *
     * @author Lv.Mingwei
     */
    @Entity(name = "endpoint")
    public static class UserEndpoint extends SuperPojo implements Cloneable {

        @Field(id = 1, type = NodeType.ATTR)
        private String entity;

        @Field(id = 3, type = NodeType.NODE)
        private String displayname;

        @Field(id = 2, type = NodeType.NODE)
        private String status;

        @Field(id = 4, name = "disconnection-method", type = NodeType.NODE)
        private String disConMethod;

        @Field(id = 5, name = "supported-medias", type = NodeType.NODE)
        private SupportedMedias supportedMedias;

        public SupportedMedias getSupportedMedias() {
            return supportedMedias;
        }

        public void setSupportedMedias(SupportedMedias supportedMedias) {
            this.supportedMedias = supportedMedias;
        }

        public String getEntity() {
            return entity;
        }

        public String getDisplayname() {
            return displayname;
        }

        public void setDisplayname(String displayname) {
            this.displayname = displayname;
        }

        public void setEntity(String entity) {
            this.entity = entity;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getDisConMethod() {
            return disConMethod;
        }

        public void setDisConMethod(String disConMethod) {
            this.disConMethod = disConMethod;
        }

        @Override
        public UserEndpoint clone() {
            UserEndpoint retval = new UserEndpoint();
            retval.entity = entity;
            retval.status = status;
            retval.disConMethod = disConMethod;
            return retval;
        }
    }
}
